<template>
  <div>
    <div class="logout" v-show="name">
        <span>{{name}} | </span>
        <a @click="logOut" href="#">退出</a>
    </div>
    <div class="login" v-show="!name">
        <router-link to="/my/MyTab/login">登录</router-link>
        <router-link to="/my/MyTab/register">注册</router-link>
    </div>
    <div class="footer">
        <ul class="footBtn">
            <li>
                <span><i class="iconfont icon-dianhua"></i></span>
                <em>帮助</em>
            </li>
            <li>
                <span><i class="iconfont icon-xiazai"></i></span>
                <em>客户端</em>
            </li>
            <li>
                <span><i class="iconfont icon-weixin"></i></span>
                <em>微信</em>
            </li>
            <li>
                <span><i class="iconfont icon-diannaoban"></i></span>
                <em>电脑版</em>
            </li>
        </ul>
        <h3>京ICP证100557号</h3>
    </div>
  </div>
</template>

<script>
export default {
  data () {
    return {
        name:this.$store.state.user.username
    }
  },

  components: {},
  methods: {
    async logOut() {
     try{
        let p = await this.$store.dispatch("logOut")
        if(p.flag){
          this.$router.push('/my/MyTab/login')
        }else{
          this.$toast.fail("退出失败")
        }
     }catch(err){
       console.log(err)
     }
    }
  }
}
</script>

<style lang="scss" scoped>
.logout{
    padding: 42px 0;
    span{
        color: #474747;
        font-size: 14px;
    }
    a{
        color: #474747;
        font-size: 14px;
    }
}
.login{
    padding: 42px 0;
    a{
        display: inline-block;
        width: 60px;
        height: 26px;
        background: #fff;
        color: #797979;
        margin-right: 10px;
        line-height: 26px;
        text-align: center;
        font-size: 16px;
    }
}
.footer{
    .footBtn{
        border-top: 1px solid #939393;
        border-bottom: 1px solid #939393;
        width: 80%;
        height: 86px;
        margin: 0 auto;
        display: flex;
        justify-content: space-between;
        align-items: center;
        li{
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            font-size: 12px;
            .iconfont{
                font-size: 40px;
                color: #818181;
            }
            .icon-dianhua{
                font-size: 38px;
            }
        }
    }
    h3{
        margin-top: 6px;
        font-size: 12px;
    }
}
</style>